function addTable(target,event){
	event.preventDefault();
	var node = target.parentElement.parentElement.parentElement;
	node = node.previousElementSibling;
	node = node.lastElementChild;
	var newnode = node.cloneNode(true);
	node.parentElement.appendChild(newnode);
	newnode = node.parentElement.lastElementChild.firstElementChild;
	newnode.firstElementChild.value = ""
	newnode = newnode.nextElementSibling;
	newnode.firstElementChild.value = ""
	newnode = newnode.nextElementSibling;
	newnode.firstElementChild.value = ""
}

function createXmlHttp() {
  var xmlHttp = null;
  try {
	xmlHttp = new XMLHttpRequest();
  } catch (e) {
	try {
	  xmlHttp = new ActiveXObject("Msxml2.XMLHTTP");
	} catch (e) {
	  xmlHttp = new ActiveXObject("Microsoft.XMLHTTP");
	}
  }
  return xmlHttp;
}
function subMenuSet(target){
	var xmlHttp = createXmlHttp();
	var url = './trans.php?action=settopmenu';
	var form = new FormData();
	//处理数据
	var index = 1;
	var node = target.parentElement.parentElement.parentElement;
	node  = node.previousElementSibling;
	var s = node.firstElementChild;
	while(s!=null){
		var content = s.firstElementChild;

		while(content!=null){
			if(content.firstElementChild!=null&&(content.firstElementChild.nodeName=='INPUT'||content.firstElementChild.nodeName=='SELECT')){
				form.append("res"+index+"[]",content.firstElementChild.value)
			}
			content = content.nextElementSibling;
		}
		s = s.nextElementSibling;
		index++;
	}
	xmlHttp.open("POST", url, true);
	xmlHttp.onreadystatechange = function() {
	if(xmlHttp.readyState == 4 && xmlHttp.status == 200) {					
	  if(xmlHttp.responseText==1){
	  	location.replace('settings.php?') 
	  }
	}
  }
	xmlHttp.send(form);										
}